package com.ruoyi.web.controller.salon;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.SalonOrderDetail;
import com.ruoyi.system.domain.SalonService;
import com.ruoyi.system.vo.OrderServiceVo;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISalonOrderDetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 订单管理Controller
 *
 * @author 23
 * @date 2022-03-31
 */
@ResponseBody
@RestController
@RequestMapping("/system/detail")
public class SalonOrderDetailController extends BaseController
{
    @Autowired
    private ISalonOrderDetailService salonOrderDetailService;

    /**
     * 步骤1:查询订单及业务信息
     *
     * @param orderNo 订单编号
     * @return 订单
     */
//    @PreAuthorize("@ss.hasPermi('system:detail:query')")
    @ResponseBody
    @GetMapping("/getOrderInfo")
    public ResponseEntity<Map<String,Object>>getOrderInfo(@RequestParam("orderNo") String orderNo) {
        return ResponseEntity.ok(this.salonOrderDetailService.getOrderAndBusinessInformationByOrderNo(orderNo));
    }

    /**
     * 步骤2:输入待下单服务
     *
     * @param orderServiceVo 传值对象
     * @return 新增结果
     */
//    @PreAuthorize("@ss.hasPermi('system:detail:enterService')")
    @GetMapping ("/enterService")
    public ResponseEntity<List<SalonService>> enterService(OrderServiceVo orderServiceVo) {
        return ResponseEntity.ok(this.salonOrderDetailService.enterLineOrderService(orderServiceVo));
    }

    /**
     * 确认下单
     * 步骤3
     * @param orderNo 读者证号
     * @return 新增结果
     */
//    @PreAuthorize("@ss.hasPermi('system:detail:confirmChoose')")
    @GetMapping("/confirmChoose")
    public ResponseEntity<Boolean> confirmChoose(@RequestParam("orderNo") String orderNo) {
        return ResponseEntity.ok(this.salonOrderDetailService.ConfirmChooseService(orderNo));
    }
}
